import React, { PureComponent } from "react";
import { FormGroup, ControlLabel, FormControl } from "rsuite";

class CustomField extends PureComponent {
  render() {
    const {
      name,
      style,
      message,
      label,
      accepter,
      error,
      ...props
    } = this.props;
    return (
      <FormGroup style={style} className={error ? "has-error" : ""}>
        <ControlLabel>{label} </ControlLabel>
        <FormControl
          name={name}
          accepter={accepter}
          errorMessage={error}
          {...props}
        />
      </FormGroup>
    );
  }
}

export default CustomField;
